package com.aaa.java05;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2022/7/6 14:27
 * @description：学生类
 * @modified By：
 * @version: 1.0
 */
public class Student {
    String name;
    int age;
    Teacher teacher;

    public Student() {
    }

    public Student(String name, int age, Teacher teacher) {
        this.name = name;
        this.age = age;
        this.teacher = teacher;
    }
    /**
     * @create by: Teacher陈（86521760@qq.com）
     * @description: 自我介绍的方法
     * @create time: 2022/7/6 14:30
     * @param
     * @return void
     */
    public  void introduce(){

        System.out.println("我是"+name+"今年"+age+"岁，老师是"+teacher.name+"老师的年龄"+teacher.age);
    }

    /**
     * @create by: Teacher陈（86521760@qq.com）
     * @description: 静态方法，add
     * @create time: 2022/7/6 14:31
     * @param a b
     * @return  int
     */
    public   static int  add(int a,int b){
        return a+b;
    }

    public static void main(String[] args) {
        //实例化老师对象
        Teacher teacher = new Teacher("chenjian",38);
        //实例化学生对象
        Student student1 = new Student("尚腾飞",20,teacher);
        Student student2 = new Student("尚腾飞2",20,teacher);
        student1.introduce();
        student2.introduce();
        int add = Student.add(12, 30);
        System.out.println("结果："+add);
    }
}
